package ro.isdc.training.ejb3.misc.domain;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

/**
 * Person identifier.
 * 
 * @author Andrei Chirila
 */
public class PersonId extends BusinessEntityId {

  /**
   * Generated Serial Version UID
   */
  private static final long serialVersionUID = 6104687157091589343L;
  
  /**
   * Social Security Number
   */
  private String SSN;

  /**
   * @return the sSN
   */
  public String getSSN() {
    return SSN;
  }

  /**
   * @param ssn
   *          the sSN to set
   */
  public void setSSN(final String ssn) {
    this.SSN = ssn;
  }

  /**
   * @see java.lang.Object#equals(Object)
   */
  public boolean equals(final Object object) {
    if (object == this) {
      return true;
    }
    if (!(object instanceof PersonId)) {
      return false;
    }
    PersonId rhs = (PersonId) object;
    return new EqualsBuilder().append(this.SSN, rhs.SSN).append(
        this.getEntityId(), rhs.getEntityId()).isEquals();
  }

  /**
   * @see java.lang.Object#hashCode()
   */
  public int hashCode() {
    return new HashCodeBuilder(-775799347, 1230712877).append(this.SSN)
        .append(this.getEntityId()).toHashCode();
  }

  /**
   * @see java.lang.Object#toString()
   */
  public String toString() {
    return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).append(
        "SSN", this.SSN).append("entityId", this.getEntityId()).toString();
  }
  
}
